FROM php:7.3-fpm
#FROM php:7.3.19-fpm-alpine3.12

#  设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN  sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN  apt-get clean
#  更新安装依赖包和PHP核心拓展
RUN apt-get update && apt-get install -y \
        wget \
        zip \
        git \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd \
        # && docker-php-ext-install zip \
        && docker-php-ext-install pdo_mysql \
        && docker-php-ext-install opcache \
        && docker-php-ext-install mysqli \
        && rm -r /var/lib/apt/lists/*

# redis 扩展
RUN pecl install redis-5.2.2 && docker-php-ext-enable redis
# mongodb 扩展下载 pecl本地安装 开启扩展 前面已经通过 
RUN wget http://pecl.php.net/get/mongodb-1.7.4.tgz -O /tmp/mongodb.tgz \
    && pecl install /tmp/mongodb.tgz \
    && rm -rf /tmp/mongodb.tgz \
    && docker-php-ext-enable mongodb

#  Write Permission
RUN usermod -u 1000 www-data